﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Arcadium.Audio;

namespace Arcadium.GameEntities.Characters
{
    class BigEnemyCharacter : EnemyCharacter
    {
        private bool previousOnGround;

        #region Initialization

        public static Character Crate(World world, int startDirection)
        {
            if (world is HostWorld)
                return new BigEnemyCharacter(world, startDirection);
            return new RemoteCharacter(world, startDirection, CharacterType.BigEnemy);
        }

        private BigEnemyCharacter(World world, int startDirection)
            : base(world, startDirection)
        {
            Health = 10;
            SetTexture(CharacterType.BigEnemy);
        }

        #endregion

        #region Update

        public override bool Update(GameTime gameTime)
        {
            if (OnGround && !this.previousOnGround)
            {
                AudioManager.BigStomp.Play();
            }
            this.previousOnGround = OnGround;

            // Updates the character and checks if it's dead.
            if (base.Update(gameTime))
            {
                if (Health > 0)
                {
                    // TODO: this.character.SetTexture(GameEntities.Character.CharacterType.ZombieBigEnemy);
                    return false;
                }
                else
                {
                    AudioManager.SmallEnemyDeath.Play();
                    return true;
                }
            }
            return false;
        }

        #endregion
    }
}
